//
//  VideoCollectionViewCell.m
//  
//
//  Created by admin on 17/3/2.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "VideoCollectionViewCell.h"

@implementation VideoCollectionViewCell
/// 当cell已经被唤醒(展示)时调用的 (利用NewsCollectionViewCell的重用,来让TB不在过多的创建)

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    UIView * viewLow = [[UIView alloc]init];
    _viewLow = viewLow;
    viewLow.backgroundColor = [UIColor whiteColor];
    [viewLow bringSubviewToFront:self.imageViewIcon];
    [viewLow.layer setMasksToBounds:YES];
    [viewLow.layer setCornerRadius:1];
    [self insertSubview:viewLow atIndex:0];
    
    self.imageViewIcon = [[UIImageView alloc] init];
    self.imageViewIcon.clipsToBounds = YES;
    self.imageViewIcon.contentMode = UIViewContentModeScaleAspectFill;
    [viewLow insertSubview:self.imageViewIcon atIndex:1];
    
    self.titleLabel = [[UILabel alloc] init];
    [LSZSpecialPackaging setLabel_14_5_Size:self.titleLabel];

    self.titleLabel.numberOfLines = 2;
    [self addSubview:self.titleLabel];
    self.titleLabel.textColor = titleColorLSZ;
    
    [viewLow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(0);
        make.right.equalTo(self).offset(0);
        make.left.equalTo(self).offset(0);
        make.bottom.equalTo(self.mas_bottom).offset(0);
    }];
    [self.imageViewIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(0);
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.height.mas_equalTo(self.imageViewIcon.mas_width).multipliedBy(1.44);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageViewIcon.mas_bottom).offset(12);
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
//        make.height.offset(8);
        make.height.equalTo(@(40));
    }];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    [self.titleLabel sizeToFit];
}
@end
